﻿using System;
using System.Globalization;
using System.Windows.Controls;

namespace planning.Vues
{
    class ValidateurAnnee : ValidationRule
    {
        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            bool ok;
            try
            {
                int annee = int.Parse((string)value);
                ok = (annee >= 1952 && annee <= 3000);
            }
            catch (Exception)
            {
                ok = false;
            }
            return new ValidationResult(ok, null);
        }
    }
}
